package com.woniu.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * work
 * @author 
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Work implements Serializable {
    /**
     * 加班id
     */
    private Integer wno;

    /**
     * 申请人
     */
    private Integer uid;
    /**
     * 获取申请人姓名
     */
    private User user;


    /**
     * 加班区域
     */
    private String address;

    /**
     * 审核人
     */
    private String name;

    /**
     * 审核状态
     */
    private String wstate="未审核";

    /**
     * 开始时间
     */
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date btime;

    /**
     * 结束时间
     */
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date etime;

    /**
     * 时长
     */
    private Integer time;

    /**
     * 加班原因
     */
    private String reason;
    private Date bnowtime;
    private Date enowtime;

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Date getBnowtime() {
        return bnowtime;
    }

    public void setBnowtime(Date bnowtime) {
        this.bnowtime = bnowtime;
    }

    public Date getEnowtime() {
        return enowtime;
    }

    public void setEnowtime(Date enowtime) {
        this.enowtime = enowtime;
    }

    /**
     * 申请时间
     */
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date nowtime=new Date();

    private static final long serialVersionUID = 1L;

    public Integer getWno() {
        return wno;
    }

    public void setWno(Integer wno) {
        this.wno = wno;
    }

    public Integer getUid() {
        return uid;
    }

    public void setUid(Integer uid) {
        this.uid = uid;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getWstate() {
        return wstate;
    }

    public void setWstate(String wstate) {
        this.wstate = wstate;
    }

    public Date getBtime() {
        return btime;
    }

    public void setBtime(Date btime) {

        this.btime = btime;
    }

    public Date getEtime() {
        return etime;
    }

    public void setEtime(Date etime) {

        this.etime = etime;
    }

    public Integer getTime() {
        return time;
    }

    public void setTime(Integer time) {
        this.time = time;
    }

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    public Date getNowtime() {
        return nowtime;
    }

    public void setNowtime(Date nowtime) {

        this.nowtime = nowtime;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Work other = (Work) that;
        return (this.getWno() == null ? other.getWno() == null : this.getWno().equals(other.getWno()))
            && (this.getUid() == null ? other.getUid() == null : this.getUid().equals(other.getUid()))
            && (this.getAddress() == null ? other.getAddress() == null : this.getAddress().equals(other.getAddress()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getWstate() == null ? other.getWstate() == null : this.getWstate().equals(other.getWstate()))
            && (this.getBtime() == null ? other.getBtime() == null : this.getBtime().equals(other.getBtime()))
            && (this.getEtime() == null ? other.getEtime() == null : this.getEtime().equals(other.getEtime()))
            && (this.getTime() == null ? other.getTime() == null : this.getTime().equals(other.getTime()))
            && (this.getReason() == null ? other.getReason() == null : this.getReason().equals(other.getReason()))
            && (this.getNowtime() == null ? other.getNowtime() == null : this.getNowtime().equals(other.getNowtime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getWno() == null) ? 0 : getWno().hashCode());
        result = prime * result + ((getUid() == null) ? 0 : getUid().hashCode());
        result = prime * result + ((getAddress() == null) ? 0 : getAddress().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getWstate() == null) ? 0 : getWstate().hashCode());
        result = prime * result + ((getBtime() == null) ? 0 : getBtime().hashCode());
        result = prime * result + ((getEtime() == null) ? 0 : getEtime().hashCode());
        result = prime * result + ((getTime() == null) ? 0 : getTime().hashCode());
        result = prime * result + ((getReason() == null) ? 0 : getReason().hashCode());
        result = prime * result + ((getNowtime() == null) ? 0 : getNowtime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", wno=").append(wno);
        sb.append(", uid=").append(uid);
        sb.append(", address=").append(address);
        sb.append(", name=").append(name);
        sb.append(", wstate=").append(wstate);
        sb.append(", btime=").append(btime);
        sb.append(", etime=").append(etime);
        sb.append(", time=").append(time);
        sb.append(", reason=").append(reason);
        sb.append(", nowtime=").append(nowtime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}